<!DOCTYPE html>
<html lang="en" >
<head>
    <meta charset="UTF-8">
    <title>EventBind</title>
</head>
<body>
<div id="app">
num1:<input v-model="num1" type="text" /><br>
num2:<input v-model="num2" type="text" /><br>
    {{sum}}
    <button @click="addNum">计算</button>
</div>
<script src="../js/vue.js" ></script>
<script>
    const app = new Vue({
        el: '#app',
        data: {
            num1: '',
            num2: '',
            sum: ''
        },
        methods: {
            addNum(){
                this.sum = parseInt(this.num1) + parseInt(this.num2)
                console.log(this.sum)
            }
        }
    })
</script>
</body>

</html>